/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React from "react";
import { Breadcrumb } from "antd";
import PropTypes from "prop-types";
import styles from "./ChartBreadcrumb.less";

const { Item } = Breadcrumb;

const ChartBreadcrumb = ({ dataSource = [], onClick = () => {} }) => {
  return (
    <Breadcrumb className={styles.main} separator=">">
      {dataSource.map(({ branchId, name, branchLevel, adcode }) => (
        <Item onClick={() => onClick({ branchId, name, branchLevel, adcode })} key={branchId}>
          {name}
        </Item>
      ))}
    </Breadcrumb>
  );
};

ChartBreadcrumb.propTypes = {
  dataSource: PropTypes.array.isRequired,
  onClick: PropTypes.func.isRequired,
};

export default ChartBreadcrumb